<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>心之所向：我们的爱情故事</title>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=Ma+Shan+Zheng&family=ZCOOL+XiaoWei&display=swap');

        :root {
            --primary-color: #e74c3c;
            --secondary-color: #3498db;
            --accent-color: #f1c40f;
            --text-color: #2c3e50;
            --background-color: #ecf0f1;
            --white: #ffffff;
            --black: #000000;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Noto Serif SC', serif;
            line-height: 1.8;
            color: var(--text-color);
            background-color: var(--background-color);
            overflow-x: hidden;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* Header Styles */
        header {
            position: fixed;
            width: 100%;
            top: 0;
            left: 0;
            z-index: 1000;
            transition: all 0.5s ease;
            background-color: transparent;
        }

        header.scrolled {
            background-color: rgba(255, 255, 255, 0.95);
            box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
        }

        nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 5%;
            position: relative;
        }

        .logo {
            font-family: 'Ma Shan Zheng', cursive;
            font-size: 2rem;
            color: var(--white);
            text-decoration: none;
            transition: all 0.3s ease;
        }

        header.scrolled .logo {
            color: var(--primary-color);
        }

        .logo:hover {
            transform: scale(1.05);
            text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
        }

        .nav-links {
            display: flex;
            list-style: none;
        }

        .nav-links li {
            margin-left: 2rem;
        }

        .nav-links a {
            text-decoration: none;
            color: var(--white);
            font-weight: 500;
            transition: all 0.3s ease;
            position: relative;
        }

        header.scrolled .nav-links a {
            color: var(--text-color);
        }

        .nav-links a::after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: -5px;
            left: 0;
            background-color: var(--white);
            transition: all 0.3s ease;
        }

        header.scrolled .nav-links a::after {
            background-color: var(--primary-color);
        }

        .nav-links a:hover::after {
            width: 100%;
        }

        .scroll-progress {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 4px;
            background-color: var(--primary-color);
            width: 0;
            transition: width 0.3s ease-out;
        }

        /* Hero Section Styles */
        .hero {
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('static/1 (1).png') no-repeat center center;
            background-size: cover;
            color: var(--white);
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .hero::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1;
        }

        .hero-content {
            max-width: 800px;
            padding: 2rem;
            position: relative;
            z-index: 2;
        }

        .hero h1 {
            font-size: 4rem;
            margin-bottom: 1rem;
            font-family: 'ZCOOL XiaoWei', serif;
            animation: fadeInUp 1s ease-out;
        }

        .hero p {
            font-size: 1.2rem;
            margin-bottom: 2rem;
            animation: fadeInUp 1s ease-out 0.5s both;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .btn {
            display: inline-block;
            padding: 1rem 2rem;
            background-color: var(--primary-color);
            color: var(--white);
            text-decoration: none;
            border-radius: 50px;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            z-index: 1;
        }

        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 0;
            height: 100%;
            background-color: var(--secondary-color);
            transition: all 0.3s ease;
            z-index: -1;
        }

        .btn:hover::before {
            width: 100%;
        }

        .btn:hover {
            color: var(--white);
            transform: translateY(-3px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
        }

        /* Story Section Styles */
        .story-section {
            padding: 5rem 0;
            background-color: var(--white);
        }

        .story-grid {
            column-count: 3;
            column-gap: 1rem;
        }

        .story-item {
            break-inside: avoid;
            margin-bottom: 1rem;
            background-color: var(--background-color);
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }

        .story-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
        }

        .story-image {
            width: 100%;
            height: auto;
            object-fit: cover;
            cursor: pointer;
            transition: transform 0.3s ease, filter 0.3s ease;
        }

        .story-item:hover .story-image {
            transform: scale(1.05);
            filter: brightness(1.1);
        }

        .story-content {
            padding: 1.5rem;
        }

        .story-title {
            font-size: 1.5rem;
            margin-bottom: 1rem;
            color: var(--primary-color);
        }

        /* Modal Styles */
        .modal {
            display: none;
            position: fixed;
            z-index: 2000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0,0,0,0.9);
            backdrop-filter: blur(5px);
        }

        .modal-content {
            margin: auto;
            display: block;
            max-width: 90%;
            max-height: 90%;
            border-radius: 8px;
            box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
            opacity: 0;
            transform: scale(0.9);
            transition: all 0.3s ease-in-out;
        }

        .modal.show .modal-content {
            opacity: 1;
            transform: scale(1);
        }

        .close {
            position: absolute;
            top: 15px;
            right: 35px;
            color: #f1f1f1;
            font-size: 40px;
            font-weight: bold;
            transition: 0.3s;
            z-index: 1002;
        }

        .close:hover,
        .close:focus {
            color: #bbb;
            text-decoration: none;
            cursor: pointer;
        }

        .nav-btn {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(255, 255, 255, 0.5);
            color: #000;
            padding: 10px;
            border: none;
            cursor: pointer;
            font-size: 18px;
            transition: all 0.3s ease;
        }

        .nav-btn:hover {
            background-color: rgba(255, 255, 255, 0.8);
        }

        .prev {
            left: 20px;
        }

        .next {
            right: 20px;
        }

        /* Responsive Styles */
        @media screen and (max-width: 768px) {
            .hero h1 {
                font-size: 3rem;
            }

            .hero p {
                font-size: 1rem;
            }

            .story-grid {
                column-count: 2;
            }
        }

        @media screen and (max-width: 480px) {
            .story-grid {
                column-count: 1;
            }
        }
    </style>
</head>
<body>
<header>
    <nav>
        <a href="#" class="logo">心之所向</a>
        <ul class="nav-links">
            <li><a href="#home">首页</a></li>
            <li><a href="#story">我们的故事</a></li>
        </ul>
        <div class="scroll-progress"></div>
    </nav>
</header>

<section id="home" class="hero parallax">
    <div class="hero-content">
        <h1 class="fade-in">心之所向，情之所归</h1>
        <p class="fade-in">在这浩瀚宇宙中，能与你相遇，是我生命中最璀璨的星河。</p>
        <a href="#story" class="btn bounce">开启我们的故事</a>
    </div>
</section>

<section id="story" class="story-section">
    <div class="container">
        <h2 class="section-title reveal fade-bottom">我们的故事</h2>
        <div class="story-grid">
            <div class="story-item reveal fade-left">
                <img src="static/1 (2).png" alt="初次相遇" class="story-image">
                <div class="story-content">
                    <h3 class="story-title">初次相遇</h3>
                    <p>那天，阳光温柔，你的笑容如春风拂面，瞬间点亮了我的世界。</p>
                </div>
            </div>
            <div class="story-item reveal fade-right">
                <img src="static/1 (3).png" alt="甜蜜时光" class="story-image">
                <div class="story-content">
                    <h3 class="story-title">甜蜜时光</h3>
                    <p>每一个与你共度的瞬间，都是上天赐予的珍贵礼物。</p>
                </div>
            </div>
            <div class="story-item reveal fade-left">
                <img src="static/1 (4).png" alt="浪漫旅行" class="story-image">
                <div class="story-content">
                    <h3 class="story-title">浪漫旅行</h3>
                    <p>在陌生的城市，我们携手探索，你是我最美的风景。</p>
                </div>
            </div>
        </div>
    </div>
</section>
<div id="imageModal" class="modal">
    <span class="close">&times;</span>
    <img class="modal-content" id="modalImage">
    <button class="nav-btn prev">&lt;</button>
    <button class="nav-btn next">&gt;</button>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js"></script>
<script>
    // 滚动进度条和header效果
    window.addEventListener('scroll', () => {
        const header = document.querySelector('header');
        const scrollProgress = document.querySelector('.scroll-progress');
        const windowHeight = window.innerHeight;
        const fullHeight = document.body.clientHeight;
        const scrolled = window.scrollY / (fullHeight - windowHeight) * 100;

        scrollProgress.style.width = `${scrolled}%`;

        if (window.scrollY > 50) {
            header.classList.add('scrolled');
        } else {
            header.classList.remove('scrolled');
        }
    });

    // 页面滚动效果
    window.addEventListener('scroll', () => {
        // 滚动显示动画
        const reveals = document.querySelectorAll('.reveal');
        reveals.forEach(reveal => {
            const windowHeight = window.innerHeight;
            const revealTop = reveal.getBoundingClientRect().top;
            const revealPoint = 150;

            if (revealTop < windowHeight - revealPoint) {
                reveal.classList.add('active');
            } else {
                reveal.classList.remove('active');
            }
        });
    });

    // 平滑滚动
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            document.querySelector(this.getAttribute('href')).scrollIntoView({
                behavior: 'smooth'
            });
        });
    });

    // 打字机效果
    function typeWriter(element, text, speed) {
        let i = 0;
        function type() {
            if (i < text.length) {
                element.innerHTML += text.charAt(i);
                i++;
                setTimeout(type, speed);
            }
        }
        type();
    }

    // 在适当的时机调用打字机效果
    const heroTitle = document.querySelector('.hero h1');
    typeWriter(heroTitle, "心之所向，情之所归", 100);

    // 3D卡片效果
    const storyItems = document.querySelectorAll('.story-item');
    storyItems.forEach(item => {
        item.addEventListener('mousemove', (e) => {
            const rect = item.getBoundingClientRect();
            const x = e.clientX - rect.left;
            const y = e.clientY - rect.top;

            const centerX = rect.width / 2;
            const centerY = rect.height / 2;

            const deltaX = (x - centerX) / centerX;
            const deltaY = (y - centerY) / centerY;

            item.style.transform = `perspective(1000px) rotateX(${deltaY * 10}deg) rotateY(${-deltaX * 10}deg) scale3d(1.05, 1.05, 1.05)`;
        });

        item.addEventListener('mouseleave', () => {
            item.style.transform = 'perspective(1000px) rotateX(0) rotateY(0) scale3d(1, 1, 1)';
        });
    });

    // 图片模态框
    const modal = document.getElementById('imageModal');
    const modalImg = document.getElementById('modalImage');
    const closeBtn = document.getElementsByClassName('close')[0];
    const prevBtn = document.querySelector('.prev');
    const nextBtn = document.querySelector('.next');
    let currentImageIndex = 0;
    const images = Array.from(document.querySelectorAll('.story-image'));

    function openModal(img) {
        modal.style.display = "flex";
        modalImg.src = img.src;
        currentImageIndex = images.indexOf(img);
        setTimeout(() => modal.classList.add('show'), 50);
    }

    function closeModal() {
        modal.classList.remove('show');
        setTimeout(() => {
            modal.style.display = "none";
        }, 300);
    }

    function navigateImage(direction) {
        currentImageIndex += direction;
        if (currentImageIndex < 0) currentImageIndex = images.length - 1;
        if (currentImageIndex >= images.length) currentImageIndex = 0;
        modalImg.style.opacity = '0';
        setTimeout(() => {
            modalImg.src = images[currentImageIndex].src;
            modalImg.style.opacity = '1';
        }, 200);
    }

    images.forEach(img => {
        img.onclick = () => openModal(img);
    });

    closeBtn.onclick = closeModal;
    prevBtn.onclick = () => navigateImage(-1);
    nextBtn.onclick = () => navigateImage(1);

    window.onclick = (event) => {
        if (event.target == modal) closeModal();
    };

    // 键盘导航
    document.addEventListener('keydown', (e) => {
        if (modal.style.display === "flex") {
            if (e.key === "ArrowLeft") navigateImage(-1);
            if (e.key === "ArrowRight") navigateImage(1);
            if (e.key === "Escape") closeModal();
        }
    });

    // 视差滚动效果
    window.addEventListener('scroll', () => {
        const parallaxElements = document.querySelectorAll('.parallax');
        parallaxElements.forEach(element => {
            const scrollPosition = window.pageYOffset;
            element.style.backgroundPositionY = scrollPosition * 0.5 + 'px';
        });
    });

    // 瀑布流布局（如果需要动态调整）
    function adjustMasonry() {
        const storyGrid = document.querySelector('.story-grid');
        if (window.innerWidth <= 480) {
            storyGrid.style.columnCount = '1';
        } else if (window.innerWidth <= 768) {
            storyGrid.style.columnCount = '2';
        } else {
            storyGrid.style.columnCount = '3';
        }
    }

    window.addEventListener('resize', adjustMasonry);
    window.addEventListener('load', adjustMasonry);
</script>
</body>
</html>